package experiment1.sort;
import java.util.Arrays;

public abstract class Sort {
    public int[] arr = null;

    Sort(int[] arr) {
        this.arr = Arrays.copyOf(arr, arr.length);

    }
    public String sortTime(){
        long start = System.currentTimeMillis();
        sort(0, arr.length - 1);
        long end = System.currentTimeMillis();
        String className = this.getClass().getName();
        StringBuilder s =  new StringBuilder(className.substring(className.lastIndexOf(".")+1) + " cost " + (end - start) + "ms:\n");

        if (arr.length <= 1000) {
            s.append(Arrays.toString(arr));
        }
        return s.toString();
    }

    public abstract void sort(int i, int j);
}

